<!-- eslint-disable vue/multi-word-component-names -->
<!-- eslint-disable vue/no-mutating-props -->
<template>
    <labelArea label="参数">
        <el-form size="small" label-suffix=" :">
            <el-form-item label="输入数目">
                <!-- <el-input-number v-model="data.Inputs" :min="2" controls-position="right" /> -->
                <el-input v-model="data.Inputs" @change="mux"></el-input>
            </el-form-item>
            <el-form-item label="显示选项">
                <el-select v-model="data.SampleTimeMode">
                    <el-option label="无" value="null" />
                    <el-option label="信号" value="signals" />
                    <el-option label="竖线" value="line" />
                </el-select>
            </el-form-item>
        </el-form>
    </labelArea>
</template>

<script setup>
import { ElMessage } from 'element-plus';
import { isNum } from '../allConfig';

const { data } = defineProps(['data'])
function mux(e) {
    // console.log('🦹‍♂️', e, isNum(e), /(\d|,)+/.test(e))
    if (isNum(e)) {
        data.Inputs = +e
    } else if (e.split(',').every(i => isNum(i))) {
        data.Inputs = `[${e}]`
    } else if (/^[\[].*[\]]$/.test(e) && e.slice(1, -1).split(',').every(i => isNum(i))) {
        data.Inputs = e
    }
    //  else return ElMessage.error('请输入正确的格式');
}
</script>


<style scoped></style>